﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
   public class DocGia_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_DocGia");
       }
       public DataTable taoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public int insert_DocGia(DocGia_Public hoTen,DocGia_Public ngaySinh,DocGia_Public gioiTinh,DocGia_Public diaChi,DocGia_Public lop,DocGia_Public dienThoai,DocGia_Public email,DocGia_Public ngayCap)
       {
           int Nparameter = 8;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@HoVaTen";
           value[0] = hoTen.HoVaTen;
           name[1] = "@NgaySinh";
           value[1] = ngayCap.NgaySinh;
           name[2] = "@GioiTinh";
           value[2] = gioiTinh.GioiTinh;
           name[3] = "@DiaChi";
           value[3] = diaChi.DiaChi;
           name[4] = "@MaLop";
           value[4] = lop.MaLop;
           name[5] = "@DienThoai";
           value[5] = dienThoai.DienThoai;
           name[6] = "@Email";
           value[6] = email.Email;
           name[7] = "@NgayCap";
           value[7] = ngayCap.NgayCap;
           return kn.update("Insert_DocGia",name,value,Nparameter);
       }
       public int update_DocGia(DocGia_Public maDocGia,DocGia_Public hoTen, DocGia_Public ngaySinh, DocGia_Public gioiTinh, DocGia_Public diaChi, DocGia_Public lop, DocGia_Public dienThoai, DocGia_Public email, DocGia_Public ngayCap)
       {
           int Nparameter = 9;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaDocGia";
           value[0] = maDocGia.MaDocGia;
           name[1] = "@HoVaTen";
           value[1] = hoTen.HoVaTen;
           name[2] = "@NgaySinh";
           value[2] = ngayCap.NgaySinh;
           name[3] = "@GioiTinh";
           value[3] = gioiTinh.GioiTinh;
           name[4] = "@DiaChi";
           value[4] = diaChi.DiaChi;
           name[5] = "@MaLop";
           value[5] = lop.MaLop;
           name[6] = "@DienThoai";
           value[6] = dienThoai.DienThoai;
           name[7] = "@Email";
           value[7] = email.Email;
           name[8] = "@NgayCap";
           value[8] = ngayCap.NgayCap;
           return kn.update("Update_DocGia", name, value, Nparameter);
       }
       public int delete_DocGia(DocGia_Public maDocGia)
       {
           int Nparameter = 1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaDocGia";
           value[0] = maDocGia.MaDocGia;
           return kn.update("Delete_DocGia", name, value, Nparameter);
       }
    }
}
